<template>
  <el-drawer
    title="选择客户"
    :visible.sync="$attrs.visable"
    :size="width"
    :before-close="handleClose"
    append-to-body
    class="groupdia"
  >
    <div class="flex h_box">
      <div class="box1 box2 h_full">
        <div class="boxheader flexbetween">
          <span>筛选</span>
          <el-button type="primary" size="small" plain class="p-3"
            >清空条件</el-button
          >
        </div>
        <div class="boxbody">
          <wechat-from />
          <div class="flexbetween bg_f7f7f7 p-8 e_exclude">
            <div class="fw-6 flexcenter">
              设置排除条件
              <el-switch
                v-model="exclude"
                active-color="#3070ff"
                inactive-color="#c7c5c5"
                active-value="1"
                inactive-value="0"
                class="ml-6"
              >
              </el-switch>
            </div>
            <div class="c_warning2">开启后将排除满足以下条件的客户</div>
          </div>
          <wechat-from v-if="exclude == 1" />
        </div>
      </div>
      <!--  -->
      <div class="box1 box3 h_full">
        <div class="boxheader flexbetween">
          <div>
            <el-checkbox v-model="checkedAll"></el-checkbox
            ><span class="c_text2 ml-22">全选本页</span>
          </div>
          <el-button type="primary" size="mini" plain>全选所有</el-button>
        </div>
        <div class="boxbody p-0">
          <div
            class="groupitem flex aligncenter"
            v-for="(item, index) in grouplist"
            :key="index"
          >
            <div class="flex groupleft">
              <div class="checkbox flexcenter">
                <el-checkbox v-model="item.checked"></el-checkbox>
              </div>
              <div class="accoutitem commhover flex mb-3">
                <img
                  src="https://wework.qpic.cn/wwpic/576270_jL0ikDqEQ1SA2FC_1697685555/0"
                  alt=""
                  class="avatar mr-12"
                />
                <div class="itemcontent">
                  <div class="c_text2 f-14 textover">长风</div>
                  <div class="c_successs f-12 textover">@微信</div>
                </div>
              </div>
            </div>
            <div class="labelbox f-12">群主</div>
          </div>
        </div>
      </div>

      <div v-if="showRight" class="box1 box4 h_full">
        <div class="boxheader flexbetween">
          <span class="c_text2 fw-6 ml-12">已选择(1)</span>
          <span class="c_primary commhover">清空</span>
        </div>
        <div class="boxbody p-12">
          <div
            class="groupitem flexbetween p-8"
            v-for="(item, index) in checkGroupList"
            :key="index"
          >
            <div class="g_name textover">{{ item.name }}</div>
            <div><i class="el-icon-remove-outline f-16 commhover"></i></div>
          </div>
        </div>
      </div>
    </div>
    <div class="drawer-footer flexend">
      <el-button size="small" @click="handleClose">取 消</el-button>
      <el-button size="small" type="primary" @click="handleSubmit"
        >确 定</el-button
      >
    </div>
  </el-drawer>
</template>
<script>
import WechatFrom from "./components/WechatFrom.vue";
export default {
  components: { WechatFrom },
  data() {
    return {
      queryParams: {
        keyword: "",
      },
      exclude: 0,
      grouplist: [
        { id: 1, name: "测试群", checked: false },
        { id: 2, name: "测试群", checked: false },
      ],
      checkGroupList: [{ id: 1, name: "测试群", checked: false }],
      checkedAll: false, //全选
    };
  },
  props: {
    width: {
      type: String,
      default: "1100px",
    },
    showRight: {
      type: Boolean,
      default: true,
    },
  },
  methods: {
    handleClose() {
      this.$emit("close", 1); //关闭弹窗;
      this.$emit("update:visable", false);
    },

    handleSubmit() {},
  },
};
</script>

<style lang="scss" scoped>
.h_box {
  height: calc(100% - 54px);
}
.box1 {
  //   width: 400px;
  border-right: 1px solid #e9e9e9;
}
.box2 {
  width: 400px;
}
.boxheader {
  padding: 0 12px;
  height: 42px;
  background: #fafafa;
  border-bottom: 1px solid #e9e9e9;
  position: sticky;
  top: 0;
  z-index: 11;
}
.groupdia {
  ::v-deep .el-dialog__body {
    padding: 0;
  }
}
.input-with-select {
  width: 225px;

  ::v-deep .el-input-group__append {
    padding: 0 14px;
    background-color: #fff;
  }
}
.boxbody {
  height: calc(100% - 42px);
  overflow-y: auto;
  padding: 10px 0;
}
.accoutitem {
  padding: 6px 12px;
  &.active {
    background-color: #ebf2ff;
  }
  &:hover {
    background-color: #f0f0f0;
  }

  .avatar {
    width: 40px;
    height: 40px;
    border-radius: 4px;
  }
  .itemcontent {
    width: calc(100% - 52px);
  }
}
.filterform {
  padding: 0 16px;
  ::v-deep .el-form-item__label {
    line-height: 26px;
    padding-bottom: 0;
  }
  ::v-deep .el-input-group__append {
    padding: 0 14px;
  }
}
.labelitem {
  display: inline-block;
  border-radius: 4px;
  border: 1px solid #e9e9e9;
  background-color: #fafafa;
  padding: 2px 7px;
  line-height: 22px;
}
.linebox {
  width: 36px;
}
.box3 {
  flex: 1 1;
  // width: 460px;
}
.groupitem {
  width: 100%;
  padding: 9px 0 !important;
  border-bottom: 1px solid #f5f5f5 !important;
  &.active {
    background-color: #ebf2ff;
  }
  &:hover {
    background-color: #f0f0f0;
  }

  .groupleft {
    width: calc(100% - 50px);
  }
  .checkbox {
    width: 40px;
  }
  .labelbox {
    background: #f1f1f4;
    border-radius: 2px;
    border: 1px solid #c1c1f1;
    color: #4b5a95;
    line-height: 20px;
    padding: 2px 8px;
  }
  .g_name {
    width: 90%;
  }
}
.box4 {
  width: 240px;
}
.e_exclude {
  margin: 20px 16px;
}
.drawer-footer {
  padding: 10px 16px;
  border-top: 1px solid #e9e9e9;
}
</style>